﻿<Window x:Class="WpfWordsLearner.Views.TestView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			xmlns:vm="clr-namespace:WpfWordsLearner.ViewModels"
		xmlns:conv="clr-namespace:WpfWordsLearner.Converters"
		Title="Test View" Height="300" Width="400">
	<Window.Resources>
		<vm:TestViewModel x:Key="TestVM"/>
		<conv:BoolToVisibilityConverter x:Key="BoolToVisibility"/>
	</Window.Resources>
	<Grid DataContext="{Binding Source={StaticResource TestVM}}" Name="MainLayout">
		<Grid.RowDefinitions>
			<RowDefinition/>
			<RowDefinition Height="40"/>
		</Grid.RowDefinitions>
		<Grid Grid.Row="0" DataContext="{Binding Path=CurrentAnswer}">
			<Grid.RowDefinitions>
				<RowDefinition/>
				<RowDefinition/>
			</Grid.RowDefinitions>
			<StackPanel Grid.Row="0" DataContext="{Binding Path=Word}">
				<TextBlock Text="Word:"/>
				<TextBox x:Name="txtWord" Text="{Binding Source={StaticResource TestVM}, Path=CurrentAnswer.Word.EnglishWord, 
													Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
			</StackPanel>
			<StackPanel Grid.Row="1">
				<TextBlock Text="Answewr:"/>
				<TextBox x:Name="txtAnswer" Text="{Binding Path=Answer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
			</StackPanel>
		</Grid>
		<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center"
					DataContext="{Binding Source={StaticResource TestVM}}">
			<Button x:Name="btnNext" Content="Next" Width="60"
					Command="{Binding Path=NextCommand}" 
					IsEnabled="{Binding Path=IsNextAvaliable}"/>
			<Button x:Name="btnResult" Content="Result" Width="60"
					Visibility="{Binding Path=IsResultAvaliable,Mode= TwoWay, Converter={StaticResource BoolToVisibility}}"
					Command="{Binding Path=ResultCommand}"/>
		</StackPanel>
	</Grid>
</Window>

